<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../../../../style.css" type="text/css" media="screen">
<link rel="stylesheet" href="../../../../../print.css" type="text/css" media="print">
<meta content="PriorityQueue,com.developmentarc.core.datastructures.utils.PriorityQueue,hasItems,items,length,addItem,next,peek,removeAllItems,removeAt,removeItem" name="keywords">
<title>com.developmentarc.core.datastructures.utils.PriorityQueue</title>
</head>
<body>
<script type="text/javascript" language="javascript" src="../../../../../asdoc.js"></script><script type="text/javascript" language="javascript" src="../../../../../cookies.js"></script><script type="text/javascript" language="javascript">
<!--
				asdocTitle = 'PriorityQueue - DevelopmentArc Core API Documentation';
				var baseRef = '../../../../../';
				window.onload = configPage;
			--></script>
<table style="display:none" id="titleTable" cellspacing="0" cellpadding="0" class="titleTable">
<tr>
<td align="left" class="titleTableTitle">DevelopmentArc Core API</td><td align="right" class="titleTableTopNav"><a onclick="loadClassListFrame('../../../../../all-classes.html')" href="../../../../../package-summary.html">All&nbsp;Packages</a>&nbsp;|&nbsp;<a onclick="loadClassListFrame('../../../../../all-classes.html')" href="../../../../../class-summary.html">All&nbsp;Classes</a>&nbsp;|&nbsp;<a onclick="loadClassListFrame('../../../../../index-list.html')" href="../../../../../all-index-A.html">Index</a>&nbsp;|&nbsp;<a href="../../../../../index.html?com/developmentarc/framework/datastructures/utils/PriorityQueue.html&amp;com/developmentarc/framework/datastructures/utils/class-list.html" id="framesLink1">Frames</a><a onclick="parent.location=document.location" href="" style="display:none" id="noFramesLink1">No&nbsp;Frames</a></td><td rowspan="3" align="right" class="titleTableLogo"><img alt="Adobe Logo" title="Adobe Logo" class="logoImage" src="../../../../../images/logo.jpg"></td>
</tr>
<tr class="titleTableRow2">
<td align="left" id="subTitle" class="titleTableSubTitle">Class&nbsp;PriorityQueue</td><td align="right" id="subNav" class="titleTableSubNav"><a href="#propertySummary">Properties</a>&nbsp;| <a href="#methodSummary">Methods</a></td>
</tr>
<tr class="titleTableRow3">
<td colspan="2">&nbsp;</td>
</tr>
</table>
<script type="text/javascript" language="javascript">
<!--
if (!isEclipse() || window.name != ECLIPSE_FRAME_NAME) {titleBar_setSubTitle("Class PriorityQueue"); titleBar_setSubNav(false,true,false,false,false,false,true,false,false,false,false,false,false,false);}
--></script>
<div class="MainContent">
<table cellspacing="0" cellpadding="0" class="classHeaderTable">
<tr>
<td class="classHeaderTableLabel">Package</td><td><a onclick="javascript:loadClassListFrame('class-list.html')" href="package-detail.html">com.developmentarc.core.datastructures.utils</a></td>
</tr>
<tr>
<td class="classHeaderTableLabel">Class</td><td class="classSignature">public class PriorityQueue</td>
</tr>
</table>
<p></p>
  The PriorityQueue is a data structure utility designed to
  store items in a stored order based upon a defined priority
  value.  When an item is added to the queue the item is assigned
  a priority value, 0 being the "highest" priority and unit.MAX_VALUE
  as the "lowest" priority.
  
  <p>Items that are added to the queue are sorted from highest 
  priority to lowest and when the next() method is called the
  highest priority item in the queue is returned.  Items with
  the same priority are returned in the order they where added
  to the queue (First in First out).</p>
  
  <p></p>
<br>
<hr>
</div>
<a name="propertySummary"></a>
<div class="summarySection">
<div class="summaryTableTitle">Public Properties</div>
<table id="summaryTableProperty" class="summaryTable " cellpadding="3" cellspacing="0">
<tr>
<th>&nbsp;</th><th colspan="2">Property</th><th class="summaryTableOwnerCol">Defined&nbsp;by</th>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#hasItems">hasItems</a> : Boolean<div class="summaryTableDescription">[read-only]
   Used to determine if items are currently stored inside the
   PriorityQueue.</div>
</td><td class="summaryTableOwnerCol">PriorityQueue</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#items">items</a> : Array<div class="summaryTableDescription">[read-only]
   Returns a cloned copy of the items table in the queue.</div>
</td><td class="summaryTableOwnerCol">PriorityQueue</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#length">length</a> : int<div class="summaryTableDescription">[read-only]
   The number of items currently in the PriorityQueue.</div>
</td><td class="summaryTableOwnerCol">PriorityQueue</td>
</tr>
</table>
</div>
<a name="methodSummary"></a>
<div class="summarySection">
<div class="summaryTableTitle">Public Methods</div>
<table id="summaryTableMethod" class="summaryTable " cellpadding="3" cellspacing="0">
<tr>
<th>&nbsp;</th><th colspan="2">Method</th><th class="summaryTableOwnerCol">Defined&nbsp;by</th>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#PriorityQueue()">PriorityQueue</a>()</div>
<div class="summaryTableDescription"></div>
</td><td class="summaryTableOwnerCol">PriorityQueue</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#addItem()">addItem</a>(item:*, priority:uint = 5):void</div>
<div class="summaryTableDescription">
   Adds an item to a queue based on the priority value.</div>
</td><td class="summaryTableOwnerCol">PriorityQueue</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#next()">next</a>():*</div>
<div class="summaryTableDescription">
   Used to access the next item in the queue base
   on the priority.</div>
</td><td class="summaryTableOwnerCol">PriorityQueue</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#peek()">peek</a>():*</div>
<div class="summaryTableDescription">
   Peek returns the first item in the queue without removing
   the item from the queue.</div>
</td><td class="summaryTableOwnerCol">PriorityQueue</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#removeAllItems()">removeAllItems</a>():void</div>
<div class="summaryTableDescription">
   Clears all items from the queue.</div>
</td><td class="summaryTableOwnerCol">PriorityQueue</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#removeAt()">removeAt</a>(position:uint):Boolean</div>
<div class="summaryTableDescription">
   Removes an item at the specified position.</div>
</td><td class="summaryTableOwnerCol">PriorityQueue</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#removeItem()">removeItem</a>(item:*, numberOfInstances:int, priority:int = -1):Boolean</div>
<div class="summaryTableDescription">
   Removes an item from the queue.</div>
</td><td class="summaryTableOwnerCol">PriorityQueue</td>
</tr>
</table>
</div>
<script type="text/javascript" language="javascript">
<!--
showHideInherited();
--></script>
<div class="MainContent">
<a name="propertyDetail"></a>
<div class="detailSectionHeader">Property detail</div>
<a name="hasItems"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">hasItems</td><td class="detailHeaderType">property</td>
</tr>
</table>
<div class="detailBody">
<code>hasItems:Boolean</code>&nbsp;&nbsp;[read-only]<p>
   Used to determine if items are currently stored inside the
   PriorityQueue.
    
   </p><span class="label">Implementation</span>
<br>
<code>&nbsp;&nbsp;&nbsp;&nbsp;public function get hasItems():Boolean</code>
<br>
</div>
<a name="items"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">items</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>items:Array</code>&nbsp;&nbsp;[read-only]<p>
   Returns a cloned copy of the items table in the queue.
    
   </p><span class="label">Implementation</span>
<br>
<code>&nbsp;&nbsp;&nbsp;&nbsp;public function get items():Array</code>
<br>
</div>
<a name="length"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">length</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>length:int</code>&nbsp;&nbsp;[read-only]<p>
   The number of items currently in the PriorityQueue.
    
   </p><span class="label">Implementation</span>
<br>
<code>&nbsp;&nbsp;&nbsp;&nbsp;public function get length():int</code>
<br>
</div>
<a name="constructorDetail"></a>
<div class="detailSectionHeader">Constructor detail</div>
<a name="PriorityQueue()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">PriorityQueue</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">constructor</td>
</tr>
</table>
<div class="detailBody">
<code>public function PriorityQueue()</code>
</div>
<a name="methodDetail"></a>
<div class="detailSectionHeader">Method detail</div>
<a name="addItem()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">addItem</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td>
</tr>
</table>
<div class="detailBody">
<code>public function addItem(item:*, priority:uint = 5):void</code><p>
   Adds an item to a queue based on the priority value.
   The queue always starts at the zero postion when next()
   is called so the prioirty value determines where the item
   should reside in the queue.  The lowest priority is 0, which
   overrides all other priorities.  By default the priority is
   set to 5.
   
   </p><p>Example: An item of priority 3 is added to the queue.  The
   addItem() method first checks to see if there are any items of
   a higher or the same priority of the item.  If there are items of
   higher or same priority the new item is put behind the existing
   items.</p>
   
   <span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">item</span>:*</code> &mdash; The item to add to the queue.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">priority</span>:uint</code> (default = <code>5</code>)<code></code> &mdash; The prioirty to assign the item.
   
   </td>
</tr>
</table>
</div>
<a name="next()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">next</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function next():*</code><p>
   Used to access the next item in the queue base
   on the priority.  If no items are in the queue
   then null is returned.  It is recommened that you
   check hasItems before calling next to prevent returning
   a null value.
    
   </p><p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>*</code> &mdash; The next item in the queue based in the highest priority.
   
   </td>
</tr>
</table>
</div>
<a name="peek()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">peek</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function peek():*</code><p>
   Peek returns the first item in the queue without removing
   the item from the queue.  This enables you to peek at the
   item without adjust the order in the queue.
    
   </p><p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>*</code> &mdash; First item in the queue, null if no items in the queue.
   
   </td>
</tr>
</table>
</div>
<a name="removeAllItems()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">removeAllItems</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function removeAllItems():void</code><p>
   Clears all items from the queue. 
   
   </p></div>
<a name="removeAt()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">removeAt</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function removeAt(position:uint):Boolean</code><p>
   Removes an item at the specified position.  If the position
   is invalid then a false value is returned stating that the item
   was not removed at the provided position.  If the position is valid
   the method returns a true for success.
    
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">position</span>:uint</code> &mdash; The position in the PriorityQueue to remove.
   </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>Boolean</code> &mdash; True for successful removal, false for an invalid position.
   
   </td>
</tr>
</table>
</div>
<a name="removeItem()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">removeItem</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function removeItem(item:*, numberOfInstances:int, priority:int = -1):Boolean</code><p>
   Removes an item from the queue.  Items can have multiple
   instances stored inside a queue so if if you only wish to
   remove a specific number of instances from the queue but
   leave the rest you can provide a value in the numberOfInstances
   argument.  By default all instance of the requested item are
   removed.
    
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">item</span>:*</code> &mdash; The item to remove from the queue.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">numberOfInstances</span>:int</code> &mdash; The number of instances to look for.
   
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">priority</span>:int</code> (default = <code>-1</code>)<code></code></td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>Boolean</code> &mdash; Boolean True if one or more instances were found, otherwise False
   
   </td>
</tr>
</table>
</div>
<br>
<br>
<hr>
<br>
<p></p>
<center class="copyright"> 
</center>
</div>
</body>
</html>
<!-- -->
